/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.recharge.dao;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.boxin.ims.modules.recharge.entity.Recharge;
import com.thinkgem.jeesite.common.persistence.BaseDao;
import com.thinkgem.jeesite.common.persistence.BaseDaoImpl;

/**
 * 会员充值DAO接口
 * @author Jakemanse
 * @version 2014-03-03
 */
public interface RechargeDao extends RechargeDaoCustom, CrudRepository<Recharge, Long> {

	@Modifying
	@Query("delete from  Recharge   where id = ?1")
	public int deleteById(Long id);
	
	
	@Query("from Recharge  where user.id=?1 and number = ?2")
	public	Recharge getRechargeByUserIdAndNumber(Long id,String number);
	
	
	
	@Query("from Recharge t where t.member.id=?1 ")
	public	Recharge getRechargeByMemberId(Long id);
	
	@Query("from  Recharge   where number = ?1")
	public Recharge  getRechargeByNumber(String number);
	
}

/**
 * DAO自定义接口
 * @author Jakemanse
 */
interface RechargeDaoCustom extends BaseDao<Recharge> {

}

/**
 * DAO自定义接口实现
 * @author Jakemanse
 */
@Component
class RechargeDaoImpl extends BaseDaoImpl<Recharge> implements RechargeDaoCustom {

}
